#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""docstring
models
"""
import os
import re
import json
from datetime import datetime

from flask import url_for
from werkzeug import cached_property
from sqlalchemy.ext.hybrid import hybrid_property
from flask.ext.sqlalchemy import BaseQuery
from planet.extensions import db, cache, photos


class File(db.Model):
    # query_class = FileQuery

    id = db.Column(db.Integer, primary_key=True)
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
    title = db.Column(db.String(140), index=True)
    slug = db.Column(db.String(140), index=True)
    file_path = db.Column(db.String(40))
    file_name = db.Column(db.String(140))
    file_type = db.Column(db.String(10))
    file_size = db.Column(db.Integer)
    caption = db.Column(db.Text)
    alternatve_text = db.Column(db.Text)
    description = db.Column(db.Text)
    status = db.Column(db.Integer, default=1)
    created = db.Column(db.DateTime, default=datetime.utcnow)
    updated = db.Column(db.DateTime, default=datetime.utcnow,
                        onupdate=datetime.utcnow)
